﻿app.controller('CreateMenuItemController', ['$scope', 'PizzaService', '$location', function ($scope, PizzaService, $location) {
    $scope.createPizza = function () {
        return PizzaService.createPizza($scope.name, $scope.size, $scope.toppings, $scope.crust)
            .then(function (data) {
                //success
                $location.path('/menu');
            }, function () {
                //error
                alert("Sorry I couldn't save your pizza :(");
            });
    }
}]);